// ----------------------------------------------------------------------------
// serialize_scalar_type.h
// ----------------------------------------------------------------------------
#pragma once
#include <fw/base/runtime/hash.h>
#include <fw/base/serialize/serialize_allocator.h>
#include <fw/base/serialize/serialize_scalar_value.h>
#include <fw/base/serialize/serialize_status.h>
#include <fw/base/serialize/serialize_type.h>
#include <fw/base/serialize/serialize_member.h>

namespace fw
{
	class SerializeSchema;
	
	class SerializeScalarType : public SerializeType
	{
	public:
		virtual ~SerializeScalarType();
		
		virtual void					WriteScalarValue(char* data, const SerializeScalarValue& value) const = 0;
		virtual SerializeScalarValue	ReadScalarValue	(const char* data) const = 0;
		
		virtual SerializeStatus			ConvertOne(char*				dstData,
												   const char*			srcData,
												   const SerializeType* srcType,
												   SerializeAllocator&	allocator,
												   int					arrayCount=1) const;
		
		virtual bool					IsTerminal	(const char*					data,
													 const SerializeScalarValue&	terminatorValue,
													 Hash							terminatorName) const;
		
		virtual SerializeStatus			FixUp		(SerializeSchema& schema);
		
		virtual uint64_t				GetChecksum	(uint64_t basis) const
		{
			return basis;
		}
		
		virtual const SerializeScalarType*	AsScalarType() const
		{
			return this;
		}
	}; // class SerializeScalarType
	
} // namespace fw
